﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="tintuc.aspx.cs" Inherits="NCKH.Admin.tintuc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<fieldset>
        <legend>
            <H2>
                QUẢN LÝ TIN TỨC
            </H2>
            
        </legend>
        <asp:Panel ID="pn" runat="server">
            <asp:DropDownList ID="ddldanhmuctin" runat="server" Height="26px" Width="89px"></asp:DropDownList>
            <asp:TextBox ID="txttimkiem" runat="server" Height="21px" Width="313px" OnTextChanged="txttimkiem_TextChanged"></asp:TextBox>
            <asp:Button ID="btntimkiem" runat="server" CausesValidation="false" OnClick="btntimkiem_Click"  Text="Tìm kiếm" Height="28px" Width="83px"/>
            <%--<asp:Button ID="btnxoa" runat="server" Text="Xóa" CausesValidation="false" OnClick="btnxoa_Click" Height="28px" Width="77px" />--%>
            <asp:Button ID="btnthem" runat="server" Text="Thêm" CausesValidation="false" OnClick="btnthem_Click" Height="28px" Width="72px" />


            <asp:GridView ID="grvtintuc" runat="server" AllowPaging="true" OnPageIndexChanging="grvtintuc_PageIndexChanging" DataKeyNames="Manoidungtin"
                 AutoGenerateColumns="false" EnableViewState="false" OnRowDataBound="grvtintuc_RowDataBound" Width="699px"
                 OnSelectedIndexChanged="grvtintuc_SelectedIndexChanged" OnRowCommand="grvtintuc_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="STT">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <%--<asp:TemplateField HeaderText="Chọn">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkchon" runat="server" />
                        </ItemTemplate>                                           
                    </asp:TemplateField>--%>
                    <asp:TemplateField HeaderText="xóa">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtxoa" runat="server" CommandName="xoa" 
                                    CommandArgument='<%# Eval("Manoidungtin") %>' >xóa</asp:LinkButton>
                           <%--OnClientClick='return confirm("bạn có chắc chắn muốn xóa không??")'--%>
                        </ItemTemplate>
                    </asp:TemplateField>
                        
                    <asp:BoundField DataField="Manoidungtin" HeaderText="Mã Tin " 
           InsertVisible="False" Visible="false" ReadOnly="True" SortExpression="Manoidungtin" />            
                    <asp:TemplateField HeaderText="Tiêu đề" SortExpression="Manoidungtin">
                        <ItemTemplate>
                            <asp:HyperLink ID="hltieude" runat="server" Text='<%# Eval("Tieude") %>' NavigateUrl='<%# Eval("Manoidungtin", "/Admin/suatintuc.aspx?id={0}") %>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Danh mục">
                        <ItemTemplate>
                            <asp:Label ID="lbldanhmuc" runat="server" Text='<%# Eval("Tendanhmuctin") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tóm tắt">
                        <ItemTemplate>
                            <asp:Label ID="lbltomtat" runat="server" Text='<%# Eval("Tomtat") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="Ngày tạo" DataField="Ngaytao" DataFormatString="{0:dd/mm/yyyy}" />
     
                    <asp:TemplateField HeaderText="tag">
                        <ItemTemplate>
                            <asp:Label ID="lbltag" runat="server" Text='<%# Eval("Tag") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Image">
                        <ItemTemplate>
                            <a href='<%# Eval("Image") %>'><asp:Image ID="image" runat="server" ImageUrl='<%# Eval("Image") %>' Width="100px" Height="100px" /></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                   <asp:BoundField HeaderText ="hiển thị" DataField="bhienthi" />
                    <asp:TemplateField HeaderText="Trạng thái">
                        <ItemTemplate>
                            <asp:Label ID="lbtrangthai" runat="server" Text='<%# Eval("trangthaitin") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </asp:Panel>
    </fieldset>
</asp:Content>    